package bootstrap

import (
	"log"
	"syscall"

	"github.com/spf13/cobra"
	"insighttracking/common/utils"
)

var Stop = &cobra.Command{Use: "stop", RunE: func(cmd *cobra.Command, args []string) (err error) {
	procList, err := utils.FindProcessByName(`"customer-api start"`)
	if err != nil {
		return
	}
	for _, proc := range procList {
		if err = proc.Signal(syscall.SIGINT); err != nil {
			log.Fatal("Failed to send SIGINT signal")
		}
	}
	return
}}
